home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Complete Internet Archive
/
Complete Internet Archive.iso
/
VRML
/
cp2b2x.exe
/
DATA.Z
/
vsinit.tcl
< prev
next >
Wrap
Text File
|
1996-04-23
|
15KB
|
469 lines
#*-----------------------------------------------------------------------
# * Copyright(C) 1995 Sony Corporation
# * All Rights Reserved.
# *
# * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Sony Corporation;
# * the contents of this file is not to be disclosed to third parties, copied
# * or duplicated in any form, in whole or in part, without the prior written
# * permission of Sony Corporation.
# *
# * File: vsinit.tcl
# * Auther: sugino
# *
# History:
# 1.02 95/12/20: Camera, Light attributes added.
# 1.03 96/02/02: vscp wrapper added.
# 1.04 96/02/14: vscp enum flg.
# 1.05 96/02/14: CameraID vsMirrorCamera added.
# 1.06 96/02/15: Myself,SetAttr,ApplSpecific event id added.
# 1.06 96/02/15: vstkCName2Rgb added.
# 1.06 96/02/15: vsTclError changed .
# 1.07 96/03/22: add vscpSendKeepConnection.
# 1.08 96/03/29: add return status of vscpGetSockState.
# 1.08 96/03/29: add ID for vsMenuStatus, vsButtonStatus.
# *$Id$
# *---------------------------------------------------------------------
set vsVersion 1.08
#**********************************************************
# material.h:VsMaterialAttribute
#**********************************************************
set vsAllMaterialAttribute 0
set vsAmbient 1
set vsDiffuse 2
set vsSpecular 3
set vsEmissive 4
set vsShininess 5
set vsTransparency 6
set vsMaterialAttributeSize 7
#**********************************************************
# transfar.h:VsCoordSystem
#**********************************************************
set vsCSLocal 0
set vsCSWorld 1
set vsCSParent 2
set vsCSRelative 3
#**********************************************************
# transfer.h:VsTransferMode
#**********************************************************
set vsAbsolute 0
set vsRelative 1
#**********************************************************
# timeout.h:VsTaskType
#**********************************************************
set vsSporadicTask 0
set vsPeriodicTask 1
#**********************************************************
# event.h:VsBitMask(VsEventType)
#**********************************************************
set vsNoEvent 0
set vsDFeventEOF 25
set vsKeyDown [expr 1<<0]
set vsKeyUp [expr 1<<1]
set vsCollision [expr 1<<2]
#*--------------------------------------------------------
# mouse event
#*--------------------------------------------------------
set vsLeftButtonUp [expr 1<<3]
set vsLeftButtonDown [expr 1<<4]
set vsMiddleButtonUp [expr 1<<5]
set vsMiddleButtonDown [expr 1<<6]
set vsRightButtonUp [expr 1<<7]
set vsRightButtonDown [expr 1<<8]
set vsWorldIn [expr 1<<9]
set vsWorldOut [expr 1<<10]
set vsCreateNotify [expr 1<<11]
set vsDeleteNotify [expr 1<<12]
set vsTimeOut [expr 1<<13]
set vsFrame [expr 1<<14]
set vsDrag [expr 1<<15]
set vsPick [expr 1<<16]
set vsGrab [expr 1<<17]
set vsRelease [expr 1<<18]
set vsEvCreateWorld [expr 1<<19]
set vsEvApplSpecific [expr 1<<20]
set vsEvMyself [expr 1<<21]
set vsEvSetAttribute [expr 1<<22]
set vsEvIdleWarning [expr 1<<23]
set vsEvDisconnect [expr 1<<24]
set vsEvDeleteWorld [expr 1<< $vsDFeventEOF]
set vsAllEvent -1
set vsKeyEvent [expr $vsKeyDown|$vsKeyUp]
set vsMouseButtonUp \
[expr $vsLeftButtonUp|$vsRightButtonUp|$vsMiddleButtonUp]
set vsMouseButtonDown \
[expr $vsLeftButtonDown|$vsRightButtonDown|$vsMiddleButtonDown]
set vsMouseButton [expr $vsMouseButtonUp|$vsMouseButtonDown]
#**********************************************************
# script.h:VsScriptType
#**********************************************************
set vsPythonScript 0
set vsTclScript 1
set vsJavaScript 2
set vsVBScript 3
set vsCBinary 4
#**********************************************************
# 3dtypes.h:VsBoolean
#**********************************************************
set vsFalse 0
set vsTrue 1
#**************************************
# error.h:VsReturn
#**************************************
set vsSuccess 0
set vsFailure -1
set vsFindObject -2
set vsNoObject -3
set vsRangeOver -4
set vsMemoryFailure -5
set vsIdOutOfRange -6
set vsCannotPickUpShape -7
#***************************************
# Return value for TimeOutHandler .
#***************************************
set vsStop 1
set vsContinue 0
#***************************************
# event.h:VsKeyType
#***************************************
set vsKey_A 0
set vsKey_B 1
set vsKey_C 2
set vsKey_D 3
set vsKey_E 4
set vsKey_F 5
set vsKey_G 6
set vsKey_H 7
set vsKey_I 8
set vsKey_J 9
set vsKey_K 10
set vsKey_L 11
set vsKey_M 12
set vsKey_N 13
set vsKey_O 14
set vsKey_P 15
set vsKey_Q 16
set vsKey_R 17
set vsKey_S 18
set vsKey_T 19
set vsKey_U 20
set vsKey_V 21
set vsKey_W 22
set vsKey_X 23
set vsKey_Y 24
set vsKey_Z 25
set vsKey_a 26
set vsKey_b 27
set vsKey_c 28
set vsKey_d 29
set vsKey_e 30
set vsKey_f 31
set vsKey_g 32
set vsKey_h 33
set vsKey_i 34
set vsKey_j 35
set vsKey_k 36
set vsKey_l 37
set vsKey_m 38
set vsKey_n 39
set vsKey_o 40
set vsKey_p 41
set vsKey_q 42
set vsKey_r 43
set vsKey_s 44
set vsKey_t 45
set vsKey_u 46
set vsKey_v 47
set vsKey_w 48
set vsKey_x 49
set vsKey_y 50
set vsKey_z 51
set vsKey_0 52
set vsKey_1 53
set vsKey_2 54
set vsKey_3 55
set vsKey_4 56
set vsKey_5 57
set vsKey_6 58
set vsKey_7 59
set vsKey_8 60
set vsKey_9 61
set vsKey_BackSpace 62
set vsKey_Tab 63
set vsKey_LineFeed 64
set vsKey_Clear 65
set vsKey_Return 66
set vsKey_Pause 67
set vsKey_ScrollLock 68
set vsKey_Escape 69
set vsKey_Delete 70
#****************************************
# event.h:VsBitMask ( ModifierType )
#****************************************
set ShiftMask [expr 1<<0]
set LockMask [expr 1<<1]
set ControlMask [expr 1<<2]
set AltMask [expr 1<<3]
set CommandMask [expr 1<<4]
set OptionMask [expr 1<<5]
set Mod1Mask [expr 1<<6]
set Mod2Mask [expr 1<<7]
#****************************************
# gethwnd.h:VsMenuId
#****************************************
set vsForward 0
set vsBackward 1
set vsFileExit 2
set vsFileOpenUrl 3
set vsFileOpenFile 4
set vsAddBookmark 5
set vsAbout 6
set vsReload 7
set vsStopLoading 8
#****************************************
# vsButtonStatus:ButtonID
#****************************************
set vsBtnHome 112
set vsBtnUndo 113
set vsBtnJumpEye 121
set vsBtnScouter 122
#****************************************
# vsMenuStatus:MenuID
#****************************************
set vsMenuJumpEye 121
set vsMenuViewAvatar 118
set vsMenuAvatarColor 119
#****************************************
# camera.h:VsCameraId
#****************************************
set vsInvalidCamera 0
set vsDefaultCamera 1
set vsPersonEye 2
set vsWorldCamera 3
set vsMirrorCamera 4
set vsNumOfCameraID 5
#*********************************************************
#* Object's Part.
#*********************************************************/
set vsConeSide 2
set vsConeBottom 3
set vsCylinderSide 4
set vsCylinderBottom 5
set vsCylinderTop 6
#*********************************************************
#* Object's Attributes.
#*********************************************************/
set vsObjAttrId 0
set vsObjAttrparent 1
set vsObjAttrChild 2
set vsObjAttrNode 3
set vsObjAttrName 4
set vsObjAttrUrl 5
set vsObjAttrComment 6
set vsObjAttrExtention 7
set vsObjAttrHaveBcube 8
set vsObjAttrBcubeValid 9
set vsObjAttrBcubePValid 10
set vsObjAttrWRTValid 11
set vsObjAttrVisible 12
set vsObjAttrGrasp 13
set vsObjAttrSolid 14
set vsObjAttrCollision 15
set vsObjAttrMobile 16
#*********************************************************^M
#* Light's Attributes.^M
#*********************************************************/^M
set vsLightAttrOn 0
set vsLightAttrIntensity 1
set vsLightAttrColor 2
set vsLightAttrLocation 3
set vsLightAttrDirection 4
set vsLightAttrDropOffRate 5
set vsLightAttrCutOffAngle 6
#*********************************************************^M
#* Camera's Attributes.^M
#*********************************************************/^M
set vsCameraAttrPosition 0
set vsCameraAttrLookAt 1
set vsCameraAttrFocalDistance 2
set vsCameraAttrHeight 3
set vsCameraAttrHeightAngle 4
set vsCameraAttrBackground 5
############################################################
#
# suspend and resume procs.
#
# globals: vsTkWininfo(winlst) : window pathname list.
# vsTkWininfo(pathname,state) : status of pathname.
#
############################################################
proc vsTkSuspend {} {
global vsTkWininfo
set vsTkWininfo(winlst) {}
if {1 == [winfo exists .]} {
# save current state of ".".
set vsTkWininfo(.,state) [wm state .]
lappend vsTkWininfo(winlst) .
wm withdraw .
set wlist [winfo children .]
foreach d $wlist {
if {"Toplevel" == [winfo class $d]} {
# save current stat of window
set vsTkWininfo($d,state) [wm state $d]
lappend vsTkWininfo(winlst) $d
wm withdraw $d
}
}
}
}
proc vsTkResume {} {
global vsTkWininfo
if {1 != [info exists vsTkWininfo(winlst)]} {
return;
}
foreach d $vsTkWininfo(winlst) {
switch $vsTkWininfo($d,state) {
iconic { wm iconify $d }
normal { wm deiconify $d }
}
}
}
############### end of vsTkSuspend , vsTkResume ##############
# do not destroy ".".
if {"" != [info commands .]} {
wm protocol . WM_DELETE_WINDOW "wm withdraw ."
}
###################################################
# vsTclerror
###################################################
proc vsTclerror {str} {
global errorInfo tcl_platform
if {"" == [info commands .]} {
vsError "$str" ;
vsError "$errorInfo"
return
}
if {"withdrawn" == "[wm state .]"} {
vsError "$str" ;
vsError "$errorInfo"
return
}
if {1 == [catch {tkerror $str} ret]} {
vsError "$str" ;
vsError "$errorInfo"
}
}
###################################################
# vscp Functions.
###################################################
proc vscpRotate {obj args} {
set ret [eval "vsRotate $obj $args"]
vscpUpdateObj $obj
return $ret
}
proc vscpRotateAngle {obj args} {
set ret [eval "vsRotateAngle $obj $args"]
vscpUpdateObj $obj
return $ret
}
proc vscpTranslate {obj args} {
set ret [eval "vsTranslate $obj $args"]
vscpUpdateObj $obj
return $ret
}
proc vscpRotateTranslate {obj args} {
set ret [eval "vsRotateTranslate $obj $args"]
vscpUpdateObj $obj
return $ret
}
proc vscpRotateTranslateAngle {obj args} {
set ret [eval "vsRotateTranslateAngle $obj $args"]
vscpUpdateObj $obj
return $ret
}
proc vscpSendKeepConnection {v} {
# vscpKeepConnection
if {$v} {
vscpSendConnectionStateRequest 5
} {
vscpSendConnectionStateRequest 4
}
}
#*********************************************************^M
#* vscp emun.
#*********************************************************/^M
set vscpAllClientsInAura 0
set vscpAllClientsInAuraExceptMe 1
set vscpResponderOnly 2
set vscpAllClients 3
set vscpAllClientsExceptMe 4
#*********************************************************^M
#* VsSockState emun.
#*********************************************************/^M
set vsSockNotConnected 0
set vsSockConnecting 1
set vsSockConnected 2
set vsSockDisconnecting 3
#################################
# color name to RGB converter.
# return: empty space : failure
# "r g b" : success
#################################
proc vstkCName2Rgb {name} {
if {"" == "$name"} {
return ""
}
if {"" == [info command winfo]} {
}
catch "winfo rgb . $name" t
if {[regexp unknown "$t"]} {
return ""
}
set ret ""
foreach d "$t" {
lappend ret [expr $d.0 / 65535.0]
}
return "$ret"
}
## end of vsinit.tcl ##